package com.vvlive.caibao.smartcity.ui;

import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Toast;

import com.vvlive.caibao.smartcity.adapter.LifeOrderMealHuiSwimmingAdapter;
import com.vvlive.caibao.smartcity.base.BaseActivity;
import com.vvlive.caibao.smartcity.bean.LifeOrderMealStoreBean;
import com.vvlive.caibao.smartcity.utils.MyRefreshListener;
import com.vvlive.caibao.smartcity.view.CommonActionBar;
import com.vvlive.caibao.smartcity.view.PullToRefreshLayout;
import com.vvlive.caibao.smartcity.view.PullableListView;
import com.vvlive.caibao.smartcity.view.SlideShowView;

import java.util.ArrayList;
import java.util.List;

import smartcity.vvlive.caibao.com.smartc.R;

/**
 * Created by lenovo on 2015/7/4.
 * 订会展主页
 */
public class LifeBookExhibitionActivity extends BaseActivity {
    PullableListView mPullableListView;
    List<LifeOrderMealStoreBean> mBeanList = new ArrayList<>();
    Intent mIntent = new Intent();
    //<图片轮播
    SlideShowView mSlideShowView;
    View view;
    @Override
    protected int getContentViewRes() {
        return R.layout.refresh_list;
    }


    @Override
    public void initWidget() {
        super.initWidget();
        CommonActionBar actionbar = super.getCommonActionBar();
        actionbar.setTitle("会展");
        //<图片轮播
        view = LayoutInflater.from(getApplicationContext()).inflate(R.layout.life_life_book_exhibition_activity,null);
        mSlideShowView = (SlideShowView) view.findViewById(R.id.slideShowView);
        mSlideShowView.start(new int[]{
                R.mipmap.zhanhui_lb_1, R.mipmap.zhanhui_lb_2, R.mipmap.zhanhui_lb_3
        });

        //图片轮播>
        ((PullToRefreshLayout) findViewById(R.id.pulltorefreshlayout))
                .setOnRefreshListener(new MyRefreshListener());
        mPullableListView = (PullableListView) findViewById(R.id.life_buttom_list);
        mPullableListView.addHeaderView(view);
        init();
        LifeOrderMealHuiSwimmingAdapter orderMealListAdapter = new LifeOrderMealHuiSwimmingAdapter(getApplicationContext(),mBeanList);
        mPullableListView.setAdapter(orderMealListAdapter);
        mPullableListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Toast.makeText(getApplicationContext(), "会展" + position, Toast.LENGTH_SHORT).show();
                //                mIntent.setClass(getApplicationContext(), LifeRestaurantActivity.class);
                //                mIntent.putExtra("store", mBeanList.get(position));
                //                startActivity(mIntent);
            }
        });
    }

    @Override
    public void widgetClick(View v) {
        super.widgetClick(v);
        switch (v.getId()) {
        }
    }


    @Override
    protected void onStop() {
        super.onStop();
    }
    /**
     * 初始胡本地数据,测试用
     * */
    private void init(){
        mBeanList.add(new LifeOrderMealStoreBean(R.mipmap.huizhan_item_icn, "2015广州车展", 3, "25元起送", 0.0, 0.0, "",13.00));
        mBeanList.add(new LifeOrderMealStoreBean(R.mipmap.huizhan_item_icn,"2015百万瓦特会展",4,"25元起送",0.0,0.0,"",13.00));
        mBeanList.add(new LifeOrderMealStoreBean(R.mipmap.huizhan_item_icn, "2015广州车展", 3, "25元起送", 0.0, 0.0, "",13.00));
        mBeanList.add(new LifeOrderMealStoreBean(R.mipmap.huizhan_item_icn,"2015百万瓦特会展",4,"25元起送",0.0,0.0,"",13.00));
        mBeanList.add(new LifeOrderMealStoreBean(R.mipmap.huizhan_item_icn, "2015广州车展", 3, "25元起送", 0.0, 0.0, "",13.00));
        mBeanList.add(new LifeOrderMealStoreBean(R.mipmap.huizhan_item_icn,"2015百万瓦特会展",4,"25元起送",0.0,0.0,"",13.00));
        mBeanList.add(new LifeOrderMealStoreBean(R.mipmap.huizhan_item_icn, "2015广州车展", 3, "25元起送", 0.0, 0.0, "",13.00));
        mBeanList.add(new LifeOrderMealStoreBean(R.mipmap.huizhan_item_icn,"2015百万瓦特会展",4,"25元起送",0.0,0.0,"",13.00));
        mBeanList.add(new LifeOrderMealStoreBean(R.mipmap.huizhan_item_icn, "2015广州车展", 3, "25元起送", 0.0, 0.0, "", 13.00));
        mBeanList.add(new LifeOrderMealStoreBean(R.mipmap.huizhan_item_icn, "2015百万瓦特会展", 4, "25元起送", 0.0, 0.0, "", 13.00));
    }
}
